import QtQuick
import QtQuick.Controls
import Qt5Compat.GraphicalEffects


Item {
    id: root
    // 图片属性
    property string imgSource: "../resources/images/1.jpg"
    property int radius: 0
    property int imgFillMode: Image.PreserveAspectCrop
    // required property string imgUrl
    
    width: 800
    height: 600

    Rectangle {
        id: mask
        anchors.fill: parent
        radius: root.radius
        visible: false
    }

    Image{
        id: img
        source: root.imgSource
        // anchors.fill: parent
        width: root.width
        height: root.height
        fillMode: root.imgFillMode

        layer.enabled: true
        layer.effect: OpacityMask {
            maskSource: mask
        }
    }

    // Component.onCompleted: {
    //     img.source = root.imgSource
    // }
}
